package com.itheima.homework.Map接口;

import java.util.HashMap;
import java.util.Set;

public class TestCount {
    public static void main(String[] args) {
        String str = "fje你kw我FDQFj你feAF他Eajf他eo2FA我FEjfew";
        HashMap<Character,Integer> map=new HashMap<>();
        char[] chars = str.toCharArray();
        for (int i = 0; i < chars.length; i++) {
            char aChar = chars[i];
            //判断map集合中是否有每个值,
            if(map.containsKey(aChar)){
                map.put(aChar,map.get(aChar)+1);
            }else{
                map.put(aChar,1);
            }
        }
        Set<Character> set = map.keySet();
        for (Character c : set) {
            System.out.println(c+"---"+map.get(c));
        }
    }
}
